﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.ComponentModel.DataAnnotations;
using CanDoo.Core.Data;
using CanDoo.Data;
using CanDoo.Admin.Core.Models;

namespace CanDoo.Oil.Core.Models
{
    [Description("收款单类型")]
    public enum SellPayBillTypeEnum
    {
        /// <summary>
        /// 0应收冲账
        /// </summary>
        [Display(Name = "应收冲账")]
        NeedGet,
        /// <summary>
        /// 1预付款
        /// </summary>
        [Display(Name = "预付款")]
        Advance,
        /// <summary>
        /// 2期初预付款
        /// </summary>
        [Display(Name = "期初预付款")]
        BeginAdvance,
    }


    /// <summary>
    /// 实体类——销售预付款
    /// </summary>
    [Serializable]
    [Description("销售预付款")]
    public class SellAdvanceMoney :  EntityBase,ICreatedTime, IAudited,IPassAutited,IRecyclable
    {
        /// <summary>
        ///收款单号
        /// </summary>
        [Display(Name = "收款单号")]
        [Required, StringLength(50)]
        public string Code { get; set; }

        /// <summary>
        ///收款日期
        /// </summary>
        [Display(Name = "收款日期")]
        [Required]
        public DateTime? PayDate { get; set; }

        /// <summary>
        ///客户
        /// </summary>
        [Display(Name = "客户")]
        public virtual Customer Customer { get; set; }
        /// <summary>
        ///客户外键
        /// </summary>
        [Display(Name = "客户外键")]
        public long CustomerId { get; set; }

        /// <summary>
        ///收款单类型  
        /// </summary>
        [Display(Name = "收款单类型")]
        [Required]
        public SellPayBillTypeEnum SellBillType { get; set; }

        /// <summary>
        ///收款方式
        /// </summary>
        [Display(Name = "收款方式")]
        public virtual PayType PayType { get; set; }
        /// <summary>
        ///收款方式外键
        /// </summary>
        [Display(Name = "收款方式外键")]
        public long PayTypeId { get; set; }

        /// <summary>
        ///收款单金额
        /// </summary>
        [Display(Name = "收款单金额")]
        [Required]
        public double Money { get; set; }

        /// <summary>
        ///已使用金额
        /// </summary>
        [Display(Name = "已使用金额")]
        [Required]
        public double UsedMoney { get; set; }

        /// <summary>
        ///备注
        /// </summary>
        [Display(Name = "备注")]
        [StringLength(500)]
        public string Remark { get; set; }

        
        #region Implementation of ICreatedTime

        /// <summary>
        /// 获取设置 信息创建时间
        /// </summary>
        [Display(Name = "创建时间")]
        public DateTime CreatedTime { get; set; }
        #endregion

        #region Implementation of ICreatedAudited

        /// <summary>
        /// 获取或设置 创建者编号
        /// </summary>
        [Display(Name = "创建人")]
        public string CreatorUserId { get; set; }

        #endregion

        #region Implementation of IUpdateAutited

        /// <summary>
        /// 获取或设置 最后更新时间
        /// </summary>
        [Display(Name = "最后更新时间")]
        public DateTime? LastUpdatedTime { get; set; }

        /// <summary>
        /// 获取或设置 最后更新者编号
        /// </summary>
        [Display(Name = "最后更新用户")]
        public string LastUpdatorUserId { get; set; }

        #endregion
        #region IPassAutited 通过审核接口
        /// <summary>
        /// 审核状态
        /// </summary>
        [Display(Name = "审核状态")]
        public PassState PassState { get; set; }

        /// <summary>
        /// 审核用户
        /// </summary>
        [Display(Name = "审核用户")]
        public string PassAutitedUserId { get; set; }

        /// <summary>
        /// 审核时间
        /// </summary>
        [Display(Name="审核时间")]
        public DateTime? PassAutitedTime { get; set; }
        #endregion

        #region Implementation of IsDeleted 逻辑删除接口
        /// <summary>
        /// 逻辑删除接口
        /// </summary>
        [Display(Name = "是否删除")]
        public bool IsDeleted { get; set; }
        #endregion
    }
}
